<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
    // function fn(a,b){
    //     let sum = 0
    //     for(let i = a;i<= b; i++){
    //         sum += i
    //     }
    //     return sum
    // } 
    // let result = fn(50,100)//fn(+prompt('1'),+prompt('2'))
    // console.log(result)
    function fn(){
        let a = parseInt(+prompt('请输入第一个数字'))
        let b = parseInt(+prompt('请输入第二个数字'))
        let sum = 0
        for(let i = a;i<= b; i++){
           sum += i
          }
       return sum
    }
    let result = fn()
    document.write(result)
    </script>
</body>
</html>